import Vue from "vue";
import VueRouter from "vue-router";

import Layout from "@/views/layout.vue";
import Login from "@/views/login.vue";
import Register from "@/views/register.vue";

import Home from "@/views/home.vue";
import Profile from "@/views/profile.vue";
import List from "@/views/list.vue";
import News from "@/views/news.vue";

Vue.use(VueRouter);

const routes = [
  { path: "/login", component: Login },
  { path: "/register", component: Register },
  {
    path: "/",
    component: Layout,
    redirect: "/home",
    children: [
      { path: "/home", component: Home },
      { path: "/home/profile", component: Profile },
      { path: "/home/list", component: List },
      { path: "/home/news", component: News },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
